/**
 * \file Thread_Linux.cpp
 * \brief Thread declaration class for Linux platforms
 * \author Edouard ROGE
 * \date 29 august 2012
 */

#include "Core/Profile/CodeProfile.h"
#include "ThreadManager.h"
#include "Thread.h"

Thread::Thread() : m_thread(0), m_parentThread(0)
{

}

Thread::~Thread()
{
}

void Thread::Start()
{
	ThreadManager::GetInstance().Register(this);
}

uint32 Thread::GetThreadId() const
{
	return pthread_self();
}

void * Thread::RunTask(void * _pContext)
{
	Thread * pThread=(Thread*)_pContext;
	PROFILEEX("New thread", pThread->m_parentThread);
	pThread->Run();
	ThreadManager::GetInstance().Unregister(pThread);
	return pThread;
}

